package com.best.oasis.settlement.web.action.security;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.flex.remoting.RemotingDestination;
import org.springframework.stereotype.Service;

import com.best.oasis.settlement.common.entity.security.Role;
import com.best.oasis.settlement.common.vo.security.CheckedRoleTreeVO;
import com.best.oasis.settlement.common.vo.security.RoleGroupVO;
import com.best.oasis.settlement.common.vo.security.RoleVO;
import com.best.oasis.settlement.service.security.RoleGroupService;
import com.best.oasis.settlement.service.security.RoleService;
import com.best.oasis.settlement.web.action.base.BaseActionImpl;
import com.best.oasis.util.tree.TreeNode;

@RemotingDestination
@Service
public class RoleActionImpl extends BaseActionImpl<RoleVO, Role> implements RoleAction {

	@Autowired
	private RoleService roleService;
	@Autowired
	private RoleGroupService rolegroupService;
	
	@Override
	public void afterConstruct() {
		super.setBaseService(roleService);
	}
    public TreeNode getRoleTree(Long groupId) {
        return roleService.getTree(groupId);
    }
    public CheckedRoleTreeVO getCheckedRoleTree(Long groupId) {
        return roleService.getCheckedRoleTree(groupId);
    }
    public TreeNode getSelectedRoleTree(Long groupId) {
    	RoleGroupVO roleGroupVo=rolegroupService.get(groupId);
        return roleService.buildSelectedRoleTree(roleGroupVo);
    }
}
